package com.swift.maintenance.wxapi;


import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

import com.tencent.mm.sdk.openapi.IWXAPI;
import com.tencent.mm.sdk.openapi.SendMessageToWX;
import com.tencent.mm.sdk.openapi.WXMediaMessage;
import com.tencent.mm.sdk.openapi.WXWebpageObject;
import com.tencent.mm.sdk.platformtools.Util;

public class WeChatWebBean extends BaseWeChatShare{

	public WXWebpageObject webpage;
	private String webpageUrl;
	private String title;
	private String description;
	private int thumb;
	private int scene;
	
	public WeChatWebBean() {
		webpage = new WXWebpageObject();
	}



	public String getWebpageUrl() {
		return webpage.webpageUrl;
	}



	public void setWebpageUrl(String webpageUrl) {
		webpage.webpageUrl = webpageUrl;
	}



	public String getTitle() {
		return title;
	}



	public void setTitle(String title) {
		this.title = title;
	}



	public String getDescription() {
		return description;
	}



	public void setDescription(String description) {
		this.description = description;
	}



	public int getThumb() {
		return thumb;
	}



	public void setThumb(int thumb) {
		this.thumb = thumb;
	}
	
	
	
	public int getScene() {
		return scene;
	}



	public void setScene(int scene) {
		this.scene = scene;
	}



	public void send(IWXAPI api , Context context) {
		WXMediaMessage msg = new WXMediaMessage(webpage);
		msg.title = getTitle();
		msg.description = getDescription();
		Bitmap thumb = BitmapFactory.decodeResource(context.getResources(), getThumb());
		msg.thumbData = Util.bmpToByteArray(thumb, true);
		
		SendMessageToWX.Req req = new SendMessageToWX.Req();
		req.transaction = buildTransaction("webpage");
		req.message = msg;
		req.scene =  getScene();
		api.sendReq(req);
	}
	
}
